package cn.itcast.controller.stat;

import cn.itcast.controller.BaseController;
import cn.itcast.service.stat.StatService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stat")
public class StatController extends BaseController {

    @Reference
    private StatService statService;

    @RequestMapping(value = "/toCharts",name = "进入到统计数据展示页面")
    public String toCharts(String chartsType){ //  factory sell  online
        return "stat/stat-"+chartsType;
    }


    @RequestMapping(value = "/factoryCharts",name = "每个厂家货物销售总金额统计")
    @ResponseBody //把数据转成json后直接响应给浏览器
    public List<Map> factoryCharts(){ //  factory sell  online
        List<Map>  mapList = statService.factoryCharts(getCompanyId());
        return mapList;
    }
    @RequestMapping(value = "/sellCharts",name = "货物（产品）销量前15个统计")
    @ResponseBody //把数据转成json后直接响应给浏览器
    public List<Map> sellCharts(){ //  factory sell  online
        List<Map>  mapList = statService.sellCharts(getCompanyId());
        return mapList;
    }
    @RequestMapping(value = "/onlineCharts",name = "公司24小时系统访问压力图")
    @ResponseBody //把数据转成json后直接响应给浏览器
    public List<Map> onlineCharts(){ //  factory sell  online
        List<Map>  mapList = statService.onlineCharts(getCompanyId());
        return mapList;
    }

}
